<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		
	</style>
</head>
<body>

	<script>
		var str = 'ab,c,d,e,f,g';

		function reverse(str) {
			var arr = str.split(',');
			return arr.reverse().join(',');
		}

		var r = reverse(str);
		console.log(r);
	</script>
</body>
</html>